<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.model.Imgadv"%>
<%@page import="com.dao.CommonDAO"%>
<%@page import="com.util.Info"%>
<%@page import="com.model.Goods"%>
<%@page import="com.util.PageManager"%>
<%@page import="com.model.Ppinfo"%>
<%@page import="com.model.Protype"%>
<%@page import="com.model.Member"%>
<%@page import="com.model.Jieyuerecord"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html lang="en">
  <head>
    <base href="<%=basePath%>">
    
    <title>图书借阅管理系统</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
	<!-- //Custom Theme files -->
	<link href="css/bootstrap.css" type="text/css" rel="stylesheet" media="all">
	<link href="css/style.css" type="text/css" rel="stylesheet" media="all">
	<!-- js -->
	<script src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/bootstrap-3.1.1.min.js"></script>
	<script src="js/imagezoom.js"></script>
	<!-- //js -->
	<!-- cart -->
	<script src="js/simpleCart.min.js"> </script>
	<!-- cart -->
	<!-- FlexSlider -->
	<script defer src="js/jquery.flexslider.js"></script>
	<link rel="stylesheet" href="css/flexslider.css" type="text/css" media="screen" />
	
	<script>
	// Can also be used with $(document).ready()
	$(window).load(function() {
	  $('.flexslider').flexslider({
		animation: "slide",
		controlNav: "thumbnails"
	  });
	});
</script>
	
	<!-- //Custom Theme files -->
<link href="css/form.css" rel="stylesheet" type="text/css" media="all" />
<!-- js -->
<!-- //js -->	
<!-- cart -->
<!-- cart -->
<!-- the jScrollPane script -->
<script type="text/javascript" src="js/jquery.jscrollpane.min.js"></script>
		<script type="text/javascript" id="sourcecode">
			$(function()
			{
				$('.scroll-pane').jScrollPane();
			});
		</script>
<!-- //the jScrollPane script -->
<script type="text/javascript" src="/bookborrowssh/layer/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="/bookborrowssh/layer/layer.js"></script>
<script type="text/javascript" src="js/jquery.mousewheel.js"></script>


<!-- the mousewheel plugin -->
  </head>
    <%
    CommonDAO dao = (CommonDAO)Info.getDao(request,"CommonDAO");  
    String gid = request.getParameter("gid");
    Goods goods = (Goods)dao.findById(gid,"Goods");
    Member member = (Member)session.getAttribute("member");
    %>
  <body>
  	<jsp:include page="top.jsp"></jsp:include>
  						<div align="right" style="background-color: #FFAA25;height: 40px">
					</div>		
   
							<div class="alert alert-info" id="tsinfo" style="display: none;">
						        <button type="button" class="close" data-dismiss="alert">×</button>
					    	</div>
					    	
					    	<!-- 眉 开始 -->
					    	    <div class="collpse tabs">
									<div class="container">
										<div class="panel-group collpse" id="accordion" role="tablist" aria-multiselectable="true">
											<div class="panel panel-default">
					    	<div class="panel-heading" role="tab" id="headingOne">
								<h4 class="panel-title">
									<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
									  图书详情
									</a>
								</h4>
							</div>
							</div>
							</div>
							</div>
							</div>
							<!-- 眉 结束  -->
							
							
<div class="single">
		<div class="container">
			<div class="single-grids">				
				<div class="col-md-4 single-grid">		
					<div class="flexslider">
						<ul class="slides">
							<li data-thumb="images/s1.png">
								<div class="thumb-image"> <img src="upfile/<%=goods.getFilename() %>" data-imagezoom="true" class="img-responsive"> </div>
							</li>
						</ul>
					</div>
				</div>	
				<%
				Ppinfo ppmap = (Ppinfo)dao.findById(goods.getGoodpp(),"Ppinfo"); 
				Protype fmap = (Protype)dao.findById(goods.getFid(),"Protype");
				Protype smap = (Protype)dao.findById(goods.getSid(),"Protype");
				%>
				<div class="col-md-4 single-grid simpleCart_shelfItem">	
					<h3 style="border:0px solid red;"><%=goods.getGoodname() %> </h3>
					<ul class="size">
					    <li><B>编号:</B>&nbsp;&nbsp;<%=goods.getGoodno() %></li>
					</ul>
					<ul class="size">
					    <li><B>作者:</B>&nbsp;&nbsp;<%=goods.getAuthor() %></li>
					</ul>
					<ul class="size">
					    <li><B>译者:</B>&nbsp;&nbsp;<%=goods.getYizhe() %></li>
					</ul>
					<ul class="size">
					    <li><B>字数:</B>&nbsp;&nbsp;<%=goods.getZishu() %>字</li>
					</ul>
					<ul class="size">
					    <li><B>出版社:</B>&nbsp;&nbsp;<%=ppmap.getPpname() %></li>
					</ul>
					<ul class="size">
					    <li><B>位置:</B>&nbsp;&nbsp;<%=goods.getWeizi() %></li>
					</ul>
					
					<ul class="size">
					    <li><B>库存:</B>&nbsp;&nbsp;<%=dao.getkc(Integer.parseInt(gid)) %></li>
					</ul>
					
					<div class="btn_form" style="border:0px solid red;width: 300px;">
					<%if(member!=null){ %>
					<input type="hidden" value="<%=goods.getId() %>" id="gid" name="gid" >
					<%
					ArrayList<Jieyuerecord> jylist = (ArrayList<Jieyuerecord>)dao.findByHql("from Jieyuerecord where gid='"+goods.getId()+"'   and (iszj='' or iszj='在借')");
					if(dao.getkc(Integer.parseInt(gid))!=0){
					%>
					 <input type="hidden" id="hiddenmember" value="<%=member.getId() %>"/>
						<a href="javascript:jieyue('<%=goods.getId() %>')" class="add-cart item_add">借阅图书</a>	<br/>
						<%}%>
						<a href="javascript:tofav(1)" class="add-cart item_add">想读</a>
					    <a href="javascript:tofav(2)" class="add-cart item_add">在读</a>
					    <a href="javascript:tofav(3)" class="add-cart item_add">读过</a>
						<%}else{ %>
						<a class="add-cart item_add" href="login.jsp">精彩尽在登录后</a>	
						<%} %>
					</div>
				</div>
				
				<div class="clearfix"> </div>
			</div>
		</div>
	</div>
	
	
	<!-- collapse -->
	<div class="collpse tabs">
		<div class="container">
			<div class="panel-group collpse" id="accordion" role="tablist" aria-multiselectable="true">
				<div class="panel panel-default">
					<div class="panel-heading" role="tab" id="headingOne">
						<h4 class="panel-title">
							<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
							  图书详情
							</a>
						</h4>
					</div>
					<div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
						<div class="panel-body">
							<%=goods.getNote() %>
						</div>
					</div>
				</div>
				
				
				<!-- s -->
				
				<div class="panel panel-default">
					<div class="panel-heading" role="tab" id="headingTwo">
						<h4 class="panel-title">
							<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
							   评论
							</a>
						</h4>
					</div>
					<div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
						<div class="panel-body">
<div>
 <!-- s -->
							  <!-- e -->
</div>
	
	<!-- s -->
	
	<%
	if(member!=null){
	%>
	<div class="register-top-grid">
	<form name="f1" action="pinlunAdd.action?gid=<%=gid %>" method="post">
	<input type="hidden" value="<%=member.getId() %>" name="memberid">
		<div class="input">
		    <select name="score" id="score" class="form-control" style="width: 100px;" required>
		      <option value="5">5分</option>
		      <option value="4">4分</option>
		      <option value="3">3分</option>
		      <option value="2">2分</option>
		      <option value="1">1分</option>
		    </select>
		    <label></label>
			<textarea rows="" cols="" style="width: 300px;height: 60px" class="form-control" name="content" id="content"></textarea>
		</div>
		<input type="submit" value="提交" style="background:#F07818;color:white;border-color: #F07818;border-radius:3px 3px;border:1px solid #F07818;width: 80px;">
	   <div class="clearfix"> </div>
	   </form>
      </div>
      <%} %>
				
				<!-- e -->
				</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--//collapse -->

	<jsp:include page="foot.jsp"></jsp:include>
  </body>
  <script type="text/javascript">
 function tofav(no){     
	 var gid=document.getElementById("gid").value;
	 $.ajax({  
	        type: "POST",      
	         url: "favAdd.action", //servlet的名字     
	          data: "goodid="+gid+"&type="+no, 
	         success: function(data){       
	    if(data==0){   
		    layer.msg('该图书已加入收藏夹');
	    }else{    
	     	location.href="login.jsp";
	    }     
	 }     
	});     
}   



 function jieyue(gid,booksaver){
  			location.replace("yuyuebook.jsp?gid="+gid);
	 }


 <%
 String suc = (String)request.getAttribute("suc");
 if(suc!=null){
 %>
 layer.msg('<%=suc%>');
 <%}%>
  </script>
</html>
